package validate

import (
	"github.com/gin-gonic/gin"
	"heightFive/Day_exam/day3/userApi/vender/jwt"
)

func Validate(c *gin.Context) {

	token := c.Request.Header.Get("Authentication")
	parseToken, _, err := jwt.ParesToken(token)
	if err != nil {
		c.JSON(-1, gin.H{
			"message": "token解析失败",
		})
		c.Abort()
	}
	c.Set("user", parseToken)
}
